package com.minhua.jijiehao2.mainframe.common.shareactivity.impl

import com.minhua.jijiehao2.bean.BaseBean
import com.minhua.jijiehao2.bean.ShareInfoBean
import com.minhua.jijiehao2.http.*
import com.minhua.jijiehao2.mainframe.common.shareactivity.imp.IShareModel

class ShareModel : IShareModel {
    override fun getShareInfo(map: ParamsMap, callBack: CallBack<ShareInfoBean>) {
        HttpController<ShareInfoBean>().doHttp(
                ApiClient.getInstance().api.getShareInfo(map.toRequestBody()),
                object : BaseSubscriber<ShareInfoBean>() {
                    override fun dealData(t: BaseBean<ShareInfoBean>) {
                        super.dealData(t)
                        callBack.onSuccess(t)
                    }
                }
        )
    }

    override fun setAddress(map: ParamsMap, callBack: CallBack<Any>) {
        HttpController<Any>().doHttp(
                ApiClient.getInstance().api.setAddress(map.toRequestBody()),
                object : BaseSubscriber<Any>() {
                    override fun dealData(t: BaseBean<Any>) {
                        super.dealData(t)
                        callBack.onSuccess(t)
                    }
                }
        )
    }
}